package com.lin.service;

import com.yupi.project.service.Dubbo;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Service;

@SpringBootApplication ( exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class
        })
@Service
@EnableDubbo
public class LinGatewayApplication {


    @Reference
    private Dubbo demoService;

    @Reference
    private InnerUserService innerUserService;

    public static void main(String[] args) {

        ConfigurableApplicationContext context = SpringApplication.run(LinGatewayApplication.class, args);
        LinGatewayApplication application = context.getBean(LinGatewayApplication.class);
        String result = application.doSayHello("world");
        System.out.println("result: " + result);
    }

    public String doSayHello(String name) {
        System.out.println(innerUserService.getInvokeUser("29c4fc9416dffb2f7972a39ce2a318fc"));
        return demoService.test();
    }
}
